package com.esms.controller;

import com.esms.po.Status;
import com.esms.service.ILogService;
import com.esms.service.impl.EmployeeStatusServerImpl;
import com.esms.vo.EmployeeStatusVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @author 帅帅帅帅
 *
 */

@Controller
public class EmployeeStatusController {

	@Autowired
	ILogService logService;
	
	@Autowired
	private EmployeeStatusServerImpl employeeStatusServerImpl;
	
    @RequestMapping("employeeStatus.do")
    @ResponseBody
    public EmployeeStatusVO findSelectiveGrand(
			@RequestParam String type,
			HttpSession httpSession) throws Exception {

	    List<Status> statusList = new ArrayList<Status>();
	    try{
			statusList = employeeStatusServerImpl.getEmployeeStsusList(type);
	    }catch (Exception e){
	    	e.printStackTrace();
	    }

		// 设置前台需要的数据
		EmployeeStatusVO employeeStatusVO = new EmployeeStatusVO();
		employeeStatusVO.setCode(0);
		employeeStatusVO.setMsg("");
		employeeStatusVO.setCount(statusList.size());
		employeeStatusVO.setData(statusList);
		return employeeStatusVO;
	}

}
